
class Parent(object):
    def __init__(self, name):
        self.name = name
        print("parent的init方法被调用")


class Son(Parent):
    def __init__(self, name, age):
        self.age = age
        super().__init__(name)
        print("son的init方法被调用")


class Grandson(Son):
    def __init__(self, name, age, gender):
        self.gender = gender
        super().__init__(name, age)
        print("Grandson的init方法被调用")


if __name__ == '__main__':
    gs = Grandson("张三", 18, "男")
    print(gs.name, gs.age, gs.gender)
